package objectFour;

public class StudentUtil {
    //打印指定年纪学生信息
    public  void  printStudentsState(Student[] student,int state){
        for (int i = 0; i < student.length; i++) {
            if(student[i].state==state){
                Student stu=student[i];
                System.out.println(stu.show());
            }
        }
    }
    public void sortStudents(Student[] student){
        for (int i = 0; i < student.length - 1; i++) {
            for (int j = 0; j < student.length - 1 - i; j++) {
                if(student[j].score>student[j+1].score){
                    Student temp=student[j];
                    student[j]=student[j+1];
                    student[j+1]=temp;
                }
            }
        }
    }

    public void printlnStudents(Student[] student){
        for (int i = 0; i < student.length; i++) {
            Student stu=student[i];
            System.out.println(stu.show());
        }
    }

}
